<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"  %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/lib/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/lib/jquery.metadata.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/static/lib/jquery.validate.min.js"></script>
</head>
<!-- spring标签库，form的标签和html一样，而form:input的标识是path和input标签的name效果一样 -->
<body>
	<form:form action="add" method="POST" modelAttribute="user" id="userForm">
		<table align="center">
			<tr>
				<td colspan="2"><h2 align="center">添加</h2></td>
			</tr>
			<tr>
				<td>ID</td>
				
				<td><form:input path="id"/><form:errors path="id" cssClass="error" cssStyle="color:red;"/></td>
			</tr>
			<tr>
				<td>姓名</td>
				<td><form:input path="name"/><form:errors path="name" cssClass="error" cssStyle="color:red;"/></td>
			</tr>
			<tr>
				<td>年龄</td>
				<td><form:input path="age"/><form:errors path="age" cssClass="error" cssStyle="color:red;"/></td>
			</tr>
			<tr>
				<td><button type="submit">提交</button></td>
			</tr>
		</table>
		
	</form:form>
	<script type="text/javascript">
			$().ready(function(){
				$("#userForm").validate();
			})
		</script>
</body>
</html>